﻿global using System.ComponentModel;
global using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;

namespace OpenPms.Data;
public enum ERateType
{
    过夜房, 凌晨房, 钟点房
}


[Index(nameof(HotelId), nameof(RateType), nameof(Name), IsUnique = true)]
public class TRate
{
    [Display(Name = "房价码", Description = "各酒店唯一，自动生成")]
    [DatabaseGenerated(DatabaseGeneratedOption.None)]
    public Guid Id { get; set; } = Guid.Empty;
    [JsonIgnore]
    public int HotelId { get; set; }
    [Display(Name = "房价码类型")]
    public ERateType RateType { get; set; }
    [Display(Name = "房价码名称", Description = "如“前台”、“自助机”、“总经理特惠价”等")]
    [StringLength(16)]
    public string Name { get; set; } = default!;
    [Display(Description = "房型名称的拼音的第一个字母，主要是为了录入的时候方便一点")]
    [DisplayName("房型声母")]
    [StringLength(32)]
    [JsonIgnore]
    public string PinYin { get; set; } = default!;

    [Display(Name = "最早入住", Description = "最早入住时间")]
    public TimeOnly CheckinTime { get; set; }
    [Display(Name = "最晚退房", Description = "最晚退房时间")]
    public TimeOnly CheckoutTime { get; set; }

    [Display(Name = "时长", Description = "钟点房时长，非钟点房忽略")]
    public TimeOnly HourRoomLength { get; set; }
    [Display(Name = "步长", Description = "钟点房超时后的计价周期，非钟点房忽略")]
    public TimeOnly HourRoomStepLength { get; set; }


    [DisplayName("发布")]
    [JsonIgnore]
    public bool IsPublish { get; set; }
    [DisplayName("删除")]
    [NotMapped]
    [JsonIgnore]
    public bool IsDelete { get; set; }

}

